<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <base href="<%=basePath%>"/>
    
    <title>厦大植物检索与交流系统</title>
	<meta http-equiv="pragma" content="no-cache"/>
	<meta http-equiv="cache-control" content="no-cache"/>
	<meta http-equiv="expires" content="0"/>    
	<meta http-equiv="keywords" content="厦大,植物检索,"/>
	<meta http-equiv="description" content="厦大植物检索与交流系统"/>

	<link rel="stylesheet" type="text/css" href="css/common.css"/>
	<link rel="stylesheet" type="text/css" href="css/addplant.css"/>
	<link rel="stylesheet" type="text/css" href="css/jquery.ui.all.css"/>
	<link rel="stylesheet" type="text/css" href="css/validationEngine.jquery.css"/>
	<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.7.3.custom.css"/>
	<script type="text/javascript" language="javascript" src="js/jquery-1.7.1.js"></script>
	<script type="text/javascript" language="javascript" src="js/jquery.dropdown.js"></script>
	<script type="text/javascript" language="javascript" src="js/jquery.validationEngine-zh_CN.js" charset="utf-8"></script>
  	<script type="text/javascript" language="javascript" src="js/jquery.validationEngine.js" charset="utf-8"></script>
	<script type="text/javascript" language="javascript" src="js/jquery.ui.core.js"></script>
	<script type="text/javascript" language="javascript" src="js/jquery.ui.widget.js"></script>
	<script type="text/javascript" language="javascript" src="js/jquery.ui.button.js"></script>
	<script type="text/javascript" language="javascript" src="js/jquery.bgiframe-2.1.2.js"></script>
	<script type="text/javascript" language="javascript" src="js/jquery.ui.mouse.js"></script>
	<script type="text/javascript" language="javascript" src="js/jquery.ui.draggable.js"></script>
	<script type="text/javascript" language="javascript" src="js/jquery.ui.position.js"></script>
	<script type="text/javascript" language="javascript" src="js/jquery.ui.dialog.js"></script>
	<script type="text/javascript" language="javascript" src="js/jquery.effects.core.js"></script>
	<script type="text/javascript" language="javascript" src="js/jquery.effects.slide.js"></script>
	<script type="text/javascript" language="javascript" src="js/jquery.effects.explode.js"></script>
  	<script type="text/javascript" src="js/xhrUtil.js"></script>
	<script type="text/javascript" language="javascript" src="plantmanager/addplant.js"></script>
	<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
  	<script>
  	jQuery(document).ready(function(){
  		// 绑定jquery的验证插件
  		jQuery("#plantform").validationEngine({
  			ajaxFormValidation: false,
  			validationEventTriggers:"blur", 
  			onAjaxFormComplete: ajaxValidationCallback
  		});	
  		initMap();//初始化google map
  	});
  	function ajaxValidationCallback(status, form, json, options){

  	}
  	$(function() {
		$( "input:submit", "body" ).button();
		$( "input:button", "body" ).button();
		$( "#dialogkefirst" ).dialog({
			autoOpen: false,
			show: "slide",
			hide: "explode",
			
			buttons: {
				Ok: function() {
					$( this ).dialog( "close" );
				}
			}
		});
		$( "#dialogkeexist" ).dialog({
			autoOpen: false,
			show: "slide",
			hide: "explode",
			buttons: {
				Ok: function() {
					$( this ).dialog( "close" );
				}
			}
		});
		$( "#dialogshuexist" ).dialog({
			autoOpen: false,
			show: "slide",
			hide: "explode",
			buttons: {
				Ok: function() {
					$( this ).dialog( "close" );
				}
			}
		});
	});
	
  	</script>
  </head>
  
  <body >
<div id="wrapper">
	<div id="logo">
		<h1><a href="index.html">厦大植物检索与交流平台</a></h1>
	</div>
	<hr />
	<!-- end #logo -->
	<div id="header">
		<% 
			Integer userId = (Integer)request.getSession().getAttribute("userId");
			Integer role = (Integer)request.getSession().getAttribute("role");
		%>
		<div id="menu">
			<ul class="dropdown">
				<li><a href="index.html">首页</a>
				</li>
				<li><a>植物检索</a>
					<ul class="sub_menu">
     				   <li><a href="plantManager-showSubject.html">专题库查找</a></li>
   					   <li><a href="plantManager-kindList.html?move=0&page.currentPage=1&keOrShu=1">分等级检索</a></li>
        			   <li><a href="retrieval-toMultichannel.html">多通道检索</a></li>
					   <li><a href="plantManager-mapSearch.html">地图植物定位</a></li>
					</ul>
				</li>
   				<% if(userId != null && userId > 0 ){ %>
				<li><a>植物信息管理</a>
					<ul class="sub_menu">
     				   <li><a href="plantManager-toAddPlant.html">新增植物</a></li>
   					   <li><a href="plantManager-toAddSubject.html">新增专题</a></li>
   					    <% if( role != null && role == 3){ %>
   					   <li><a href="plant-listKindKe.html">分类管理</a></li>
   					   <%} %>
					</ul>
				</li>
   				<%} %>
				<li><a>个人植物库</a>
					<ul class="sub_menu">
   					   <% if(userId != null && userId > 0 ){ %>
        			   <li><a href="system-tomodifypwd.html">修改密码</a></li>
     				   <li><a href="user-showUserInfo.html">查看个人信息</a></li>
 				       <li><a href="user-toModifyUserInfo.html">修改个人信息</a></li>
 				       <% if(userId != null && userId > 0 && role != null && role == 3){ %>
 				       <li><a href="user-userlist.html">用户管理</a></li>
 				        <%} %>
 				       <li><a href="logout.html">退出</a></li>
 				       <%}else{ %>
     				   <li><a href="system-toLogin.html?isIntercepted=1">登录</a></li>
   					   <li><a href="system-registerinfo.html">注册</a></li>
 				        <%} %>
					</ul>
				</li>
				<li><a href="forum.html">论坛</a>
				</li>
			</ul>
		</div>
		<!-- end #menu -->
	</div>
	<!-- end #header -->
	<div id="page">
		<div id="content">
			
<div class="center">
	<div class="ctitle"><br />增加植物:</div>
	<div class="add">
		<s:form id="plantform" action="plantManager-addPlant.html" method="post" enctype="multipart/form-data" onsubmit="return validation();">
			<div class="text"><label for="name">名称</label></div><input type="text" id="name" name="plant.plantName" class="validate[required,maxSize[20],ajax[ajaxPlantNameCall]]"/>
			<br /><br /><div class="text"><label for="sname">学名</label></div><input type="text" id="sname" name="plant.scientificName" class="validate[required,maxSize[50],ajax[ajaxScientificNameCall]]"/>
			<br /><br /><div class="text"><label for="englishname">英文名</label></div><input type="text" id="englishname" name="plant.englishName" class="validate[optional,maxSize[30]]"/>
			<br /><br /><div class="text"><label for="alias">别名</label></div><input type="text" id="alias" name="plant.alias" class="validate[optional,maxSize[20]]"/>
			<br /><br /><div class="text"><label for="kindke">分类</label></div><label>科</label>	
					
			<select id="ke" name="plant.kindKe" class="validate[required]" onchange="getKindKe(this.value);">
				<option value="">-----</option>
				<s:iterator id="kindke" value="kindKe">
					<option value="<s:property value="#kindke.value"/>"><s:property value="#kindke.kindKeName"/></option>
				</s:iterator>
			</select><input class="addkind" type="button" value="添加" onclick="addkind(1);"/><label>属</label>
			

			<select id="shu" name="plant.kindShu" class="validate[required]" >
				<option value="">-----</option>
			</select><input class="addkind" type="button" value="添加" onclick="addkind(2);"/>

			<br /><br /><div class="text"><label for="subject">专题</label></div>

			<select id="subject" name="plant.subject" >
				<option value="">-----</option>
				<s:iterator id="subject" value="subjects">
					<option value="<s:property value="#subject.value"/>"><s:property value="#subject.subjectName"/></option>
				</s:iterator>
			</select>

			<br /><br /><div class="text"><label for="body">形态特征</label></div><textarea id="body" name="plant.characteristic" class="validate[optional,maxSize[500]]"></textarea>
			<br /><br /><div class="text"><label for="origin">产地</label></div><textarea id="origin" name="plant.originPlace" class="validate[optional,maxSize[200]]"></textarea>
			<br /><br /><div class="text"><label for="habit">习性</label></div><textarea id="habit" name="plant.habits" class="validate[optional,maxSize[200]]"></textarea>
			<br /><br /><div class="text"><label for="grow">栽培要点</label></div><textarea id="grow" name="plant.growPoint" class="validate[optional,maxSize[200]]"></textarea>
			<br /><br /><div class="text"><label for="use">用途</label></div><textarea id="use" name="plant.application" class="validate[optional,maxSize[200]]"></textarea>
			<br /><br /><div class="text"><label for="culture">文化历史</label></div><textarea id="culture" name="plant.culture" class="validate[optional,maxSize[200]]"></textarea>
			<br /><br /><div class="text"><label for="campus">校园分布</label></div><textarea id="campus" name="plant.campus" class="validate[optional,maxSize[200]]"></textarea>
			<br /><br /><span id="photos"><div>
			<div class="text"><label>上传照片</label></div>
		<!-- 	<input type="file" value="上传" id="upload" size="20" name="upload"/>-->
		 	<input type="file" class="file" id="f1" name="upload" accept="image/*" onchange="t1.value=this.value"/>
			<input type="text" id="t1" readonly="readonly"/>
			<input type="button" value="上传" class="addkind" id="b1" onclick="f1.click()"/>
			</div></span>
			<br/><br/><div class="text"></div>
			<input type="button" value="增加照片" onclick="addphoto();" class="addkind"/>
			<input type="button" value="减少照片" onclick="removephoto();" class="addkind"/>
			<br /><br /><div class="text"><label>地理位置</label></div><div>(单击地图以获取植物所在地理位置坐标)</div>
			<div id="map"></div>
			<span id="location">
			<div><br /><br /><div class="text"><label>经度</label></div><input type="text" id="lng1" class="longitude" name="plant.longitude" readonly="readonly"/>
			<br /><br /><div class="text"><label>纬度</label></div><input type="text" id="lat1" class="latitude" name="plant.latitude" readonly="readonly"/>
			</div>
			</span>
			<br/><br/><div class="text"></div>
			<input type="button" value="增加位置" onclick="addlocation();" class="addkind"/>
			<input type="button" value="减少位置" onclick="removelocation();" class="addkind"/>
   			<p class="submit"><input type="submit" value="增加新植物" /></p>
		</s:form>
	</div>
	<!-- end #add -->
</div>
<!-- end #center -->
		</div>
		<!-- end #content -->
		<div id="dialogkefirst" title="提示">
			<p>
				<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
		请先选择科
			</p>
		</div>
		<!-- end #dialogkefirst -->
		<div id="dialogkeexist" title="提示">
			<p>
				<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
		系统中已经存在此科分类
			</p>
		</div>
		<!-- end #dialogkeexist -->
		<div id="dialogshuexist" title="提示">
			<p>
				<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
		系统中已经存在此科分属
			</p>
		</div>
		<!-- end #dialogshuexist -->
		<div style="clear: both;">&nbsp;</div>
	</div>
	<!-- end #page -->
	<div id="footer">
		<p>
		<a href="index.html">返回首页</a>|
            Copyright &copy; 2012 厦门大学软件学院</p>
	</div>
	<!-- end #footer -->
</div>
</body>
</html>
